package com.ym.manager.admin.goods.model;

import com.ym.utils.Convert;

import java.util.List;
import java.util.Map;

public class GoodsStatusTotal {
    /**全部产品**/
    private int allGoods = 0;
    /**已上架**/
    private int upGoods = 0;
    /**未上架**/
    private int downGoods = 0;
    /**待审核**/
    private int waitExamine = 0;

    public int getAllGoods() {
        return allGoods;
    }

    public void setAllGoods(int allGoods) {
        this.allGoods = allGoods;
    }

    public int getUpGoods() {
        return upGoods;
    }

    public void setUpGoods(int upGoods) {
        this.upGoods = upGoods;
    }

    public int getDownGoods() {
        return downGoods;
    }

    public void setDownGoods(int downGoods) {
        this.downGoods = downGoods;
    }

    public int getWaitExamine() {
        return waitExamine;
    }

    public void setWaitExamine(int waitExamine) {
        this.waitExamine = waitExamine;
    }

    public GoodsStatusTotal(List<Map<String,Object>> list){
        for(Map<String,Object> map:list){
            this.allGoods += Convert.objToInt(map.get("count"));
            switch (Convert.objToInt(map.get("status"))){
                case 0:
                    this.downGoods += Convert.objToInt(map.get("count"));
                    break;
                case 1:
                    this.upGoods += Convert.objToInt(map.get("count"));
                    break;
                case 2:
                    this.waitExamine += Convert.objToInt(map.get("count"));
                    break;
                case 3:
                    this.waitExamine += Convert.objToInt(map.get("count"));
                    break;
            }
        }
    }
}
